<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"  xmlns:th="http://www.thymeleaf.org">
<head>
<title>手机注册</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">
<link rel="stylesheet" href="lib/weui.min.css">
<link rel="stylesheet" href="css/jquery-weui.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body ontouchstart>
<!--主体-->
<header class="wy-header">
  <div class="wy-header-icon-back" onclick="back();"><span></span></div>
  <div class="wy-header-title">手机注册</div>
</header>

<FORM action="registl.htm" METHOD="post" id="sbumitq">
<div class="weui-content">
  <div class="weui-cells weui-cells_form wy-address-edit">
    <div class="weui-cell weui-cell_vcode">
      <div class="weui-cell__hd"><label class="weui-label wy-lab">手机号</label></div>
      <div class="weui-cell__bd"><input class="weui-input" type="tel" placeholder="请输入手机号" name="phone" id="phone"></div>
      <div class="weui-cell__ft"><div style="cursor: pointer" class="weui-vcode-btn" onclick="bbbb()">获取验证码</div></div>
    </div>
    <div class="weui-cell" style="display:none;" id="t1"><div id="phone01" style="color: red"></div></div>
    <div class="weui-cell">
      <div class="weui-cell__hd"><label class="weui-label wy-lab">验证码</label></div>
      <div class="weui-cell__bd"><input class="weui-input" type="number" placeholder="请输入验证码" id="yanz"></div>
    </div>
    <div class="weui-cell" style="display:none;" id="t2"><div id="yanz2" style="color: red"></div></div>
    <div class="weui-cell">
      <div class="weui-cell__hd"><label class="weui-label wy-lab">设置密码</label></div>
      <div class="weui-cell__bd"><input class="weui-input" type="number" pattern="[0-9]*" placeholder="请输入新密码" id="pwd01"></div>
    </div>
      <div class="weui-cell" style="display:none;"  id="t3"><div id="pwd2" style="color: red"></div></div>
    <div class="weui-cell">
      <div class="weui-cell__hd"><label class="weui-label wy-lab">确认密码</label></div>
      <div class="weui-cell__bd"><input class="weui-input" type="number" pattern="[0-9]*" placeholder="请再次输入新密码" name="password" id="pwd02"></div>
    </div>
        <div class="weui-cell" style="display:none;"  id="t4"><div id="pwd1" style="color: red"></div></div>
  </div>
  <label for="weuiAgree" class="weui-agree">
    <input id="weuiAgree" type="checkbox" class="weui-agree__checkbox" checked="checked" value="check">
    <span class="weui-agree__text">阅读并同意<a href="javascript:void(0);">《注册协议》</a></span>
  </label>
  <div class="weui-btn-area"><a href="javascript:abc();" class="weui-btn weui-btn_warn">注册并登陆</a></div>
  <div class="weui-cells__tips t-c font-12">登陆账号为您输入的手机号码</div>
  <div class="weui-cells__tips t-c pd-10"><a href="xieyi.htm" class="weui-cell_link font-12">查看注册协议</a></div>

</div>
</FORM>

<script src="lib/jquery-2.1.4.js"></script>
<script src="lib/fastclick.js"></script>
<script type="text/javascript" src="js/jquery.Spinner.js"></script>
<script src="js/jquery-weui.js"></script>
<script>
 /* $(function() {
    FastClick.attach(document.body);
  });*/
 var xcode;
function bbbb(){
    var phone=$("#phone").val();
    if(phone==null || phone==""){
        $("#t1").show();
        $("#phone01").html("电话不能为空！");
        return;
    }
    var reg = /^1[0-9]{10}$/;
    if(!reg.test(phone)){
        $("#t1").show();
        $("#phone01").html("电话号码不正确！");
        return;
    }
    jQuery.ajax({
        url:"ceshi.htm",
        data:{"phone":phone},
        type:"post",
        success:function(message){
            debugger;
            if(message == 2){
                jQuery.ajax({
                    url:"duanxin.htm",
                    data:{"phone":phone},
                    type:"post",
                    success:function(message01){
                        if(message01 == 1){
                            $("#phone01").html("验证码发送失败，请检查手机号码！");
                        }else{
                            xcode=message01;
                        }
                    },
                    error:function(){
                        alert("error!");
                    }
                });
            }else{
                $("#t1").show();
                $("#phone01").html("该电话号码已注册！");
            }
        },
        error:function(){
            alert("error!");
        }
    });
}
  function abc() {
      if($("#weuiAgree").is(":checked")!= true){
          return;
      }
      var phone=$("#phone").val();
      if(phone==null || phone==""){
          $("#t1").show();
          $("#phone01").html("电话不能为空！");
          return;
      }
    var yanz=$("#yanz").val();
      var reg1 = /^[0-9]{6}$/;
      if(!reg1.test(yanz)||yanz!=xcode){
          $("#t2").show();
          $("#yanz2").html("验证码号码不正确！");
          return;
      }
      var pwd01=$("#pwd01").val();
      if(pwd01==null||pwd01==""){
          $("#t3").show();
          $("#pwd2").html("密码不能为空！");
      }
    var pwd02=$("#pwd02").val();
    if (pwd01 == pwd02){
        flag02=true;
    }else{
        $("#t4").show();
        $("#pwd1").html("两次密码输入不一致！");
        return;
    }
        $("#sbumitq").submit();
  }
 function back() {
     window.location.href=document.referrer;
 }
</script>


</body>
</html>
